package itcast.web.servlet;

import itcast.domain.Build;
import itcast.domain.Score;
import itcast.service.BuildService;
import itcast.service.ScoredromService;
import itcast.service.impl.BuildServiceImpl;
import itcast.service.impl.ScoredromServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/score_dromServlet")
public class Score_dromServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1.调用BuildService完成查询
        ScoredromService service=new ScoredromServiceImpl();
        List<Score> scores=service.findscoredromAll();
        //2.将list存入request域
        request.setAttribute("scores",scores);
        //3.转发到score_drom.jsp
        request.getRequestDispatcher("/dromitory/scoredrom.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request,response);
    }
}
